<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>kalman-cpp: kalman/kf.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">kalman-cpp
   </div>
   <div id="projectbrief">Implementation of Kalman Filter in C++</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('kf_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">kf.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="kf_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#ifndef KF_H</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#define KF_H</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="kf_8h.html#a525335710b53cb064ca56b936120431e">   25</a></span>&#160;<span class="preprocessor">#define _USE_MATH_DEFINES</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;math.h&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;assert.h&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;armadillo&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160; </div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="keyword">using namespace </span>std;</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="keyword">using namespace </span>arma;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="class_k_f.html">   37</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_k_f.html">KF</a> {</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;  <a class="code" href="class_k_f.html#ac6906ac2754b4ef3f79f45a5b7886fdd">KF</a>();</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;  <a class="code" href="class_k_f.html#af37a2d3ac0119750e546a895d9e2f279">~KF</a>();</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;  </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_k_f.html#a890367dd9a8888a2ea8bda296b6128dd">InitSystem</a> (<span class="keyword">const</span> mat&amp; A, <span class="keyword">const</span> mat&amp; B, <span class="keyword">const</span> mat&amp; H, <span class="keyword">const</span> mat&amp; Q, <span class="keyword">const</span> mat&amp; R);</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_k_f.html#a4a5efd881097162ae3d76cae2f31da4f">InitSystemState</a>(<span class="keyword">const</span> colvec&amp; x0);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  </div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_k_f.html#a351b7f3cea3e81b82c832eb901d7b4bb">InitStateCovariance</a>(<span class="keyword">const</span> mat&amp; P0);</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_k_f.html#acc63e676e77b8a6b1ccbb88dec545d99">Kalmanf</a>(<span class="keyword">const</span> colvec&amp; u);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;  </div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_k_f.html#acc63e676e77b8a6b1ccbb88dec545d99">Kalmanf</a>(<span class="keyword">const</span> colvec&amp; z, <span class="keyword">const</span> colvec&amp; u);</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;  colvec* <a class="code" href="class_k_f.html#a09da06a7f21b8d449833a0a9f130292a">GetCurrentState</a>();</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  </div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  colvec* <a class="code" href="class_k_f.html#a8ec9ee4dc0e5435a2ca9e1d2787c3e9c">GetCurrentOutput</a>();</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  colvec* <a class="code" href="class_k_f.html#abcfd6d77410e71d6df11f356ac49e6b7">GetCurrentEstimatedState</a>();</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  </div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  colvec* <a class="code" href="class_k_f.html#a5766b144d9d9d4ff395ed546e6071b76">GetCurrentEstimatedOutput</a>();</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;  </div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  </div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  mat A_;      </div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;  mat B_;      </div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  mat H_;      </div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;  mat Q_;      </div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;  mat R_;      </div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;  colvec v_;   </div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  colvec w_;   </div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;  </div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  mat sqrt_Q_; </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  mat sqrt_R_; </div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  </div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  colvec x_;   </div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;  colvec z_;   </div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  colvec x_m_; </div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;  colvec x_p_; </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;  </div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;  mat P_p_;    </div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;  mat P_m_;    </div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;  </div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;  colvec z_m_; </div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;};</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160; </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclass_k_f_html"><div class="ttname"><a href="class_k_f.html">KF</a></div><div class="ttdoc">Kalman filter implementation, for a linear system.</div><div class="ttdef"><b>Definition:</b> kf.h:37</div></div>
<div class="ttc" id="aclass_k_f_html_a09da06a7f21b8d449833a0a9f130292a"><div class="ttname"><a href="class_k_f.html#a09da06a7f21b8d449833a0a9f130292a">KF::GetCurrentState</a></div><div class="ttdeci">colvec * GetCurrentState()</div><div class="ttdoc">Get current simulated true state.</div><div class="ttdef"><b>Definition:</b> kf.cpp:110</div></div>
<div class="ttc" id="aclass_k_f_html_a351b7f3cea3e81b82c832eb901d7b4bb"><div class="ttname"><a href="class_k_f.html#a351b7f3cea3e81b82c832eb901d7b4bb">KF::InitStateCovariance</a></div><div class="ttdeci">void InitStateCovariance(const mat &amp;P0)</div><div class="ttdoc">Initialize the state covariance. Must be called after InitSystem. If not called, covariance state is ...</div><div class="ttdef"><b>Definition:</b> kf.cpp:65</div></div>
<div class="ttc" id="aclass_k_f_html_a4a5efd881097162ae3d76cae2f31da4f"><div class="ttname"><a href="class_k_f.html#a4a5efd881097162ae3d76cae2f31da4f">KF::InitSystemState</a></div><div class="ttdeci">void InitSystemState(const colvec &amp;x0)</div><div class="ttdoc">Initialize the system states. Must be called after InitSystem. If not, called, system states are init...</div><div class="ttdef"><b>Definition:</b> kf.cpp:58</div></div>
<div class="ttc" id="aclass_k_f_html_a5766b144d9d9d4ff395ed546e6071b76"><div class="ttname"><a href="class_k_f.html#a5766b144d9d9d4ff395ed546e6071b76">KF::GetCurrentEstimatedOutput</a></div><div class="ttdeci">colvec * GetCurrentEstimatedOutput()</div><div class="ttdoc">Get current estimated output. This is the filtered measurements, with less noise.</div><div class="ttdef"><b>Definition:</b> kf.cpp:125</div></div>
<div class="ttc" id="aclass_k_f_html_a890367dd9a8888a2ea8bda296b6128dd"><div class="ttname"><a href="class_k_f.html#a890367dd9a8888a2ea8bda296b6128dd">KF::InitSystem</a></div><div class="ttdeci">void InitSystem(const mat &amp;A, const mat &amp;B, const mat &amp;H, const mat &amp;Q, const mat &amp;R)</div><div class="ttdoc">Define the system.</div><div class="ttdef"><b>Definition:</b> kf.cpp:20</div></div>
<div class="ttc" id="aclass_k_f_html_a8ec9ee4dc0e5435a2ca9e1d2787c3e9c"><div class="ttname"><a href="class_k_f.html#a8ec9ee4dc0e5435a2ca9e1d2787c3e9c">KF::GetCurrentOutput</a></div><div class="ttdeci">colvec * GetCurrentOutput()</div><div class="ttdoc">Get current simulated true output. This is analogous to the measurements.</div><div class="ttdef"><b>Definition:</b> kf.cpp:115</div></div>
<div class="ttc" id="aclass_k_f_html_abcfd6d77410e71d6df11f356ac49e6b7"><div class="ttname"><a href="class_k_f.html#abcfd6d77410e71d6df11f356ac49e6b7">KF::GetCurrentEstimatedState</a></div><div class="ttdeci">colvec * GetCurrentEstimatedState()</div><div class="ttdoc">Get current estimated state.</div><div class="ttdef"><b>Definition:</b> kf.cpp:120</div></div>
<div class="ttc" id="aclass_k_f_html_ac6906ac2754b4ef3f79f45a5b7886fdd"><div class="ttname"><a href="class_k_f.html#ac6906ac2754b4ef3f79f45a5b7886fdd">KF::KF</a></div><div class="ttdeci">KF()</div><div class="ttdoc">Constructor, nothing happens here.</div><div class="ttdef"><b>Definition:</b> kf.cpp:10</div></div>
<div class="ttc" id="aclass_k_f_html_acc63e676e77b8a6b1ccbb88dec545d99"><div class="ttname"><a href="class_k_f.html#acc63e676e77b8a6b1ccbb88dec545d99">KF::Kalmanf</a></div><div class="ttdeci">void Kalmanf(const colvec &amp;u)</div><div class="ttdoc">Do Kalman filter iteration step-by-step while simulating the system. Simulating the system is done to...</div><div class="ttdef"><b>Definition:</b> kf.cpp:71</div></div>
<div class="ttc" id="aclass_k_f_html_af37a2d3ac0119750e546a895d9e2f279"><div class="ttname"><a href="class_k_f.html#af37a2d3ac0119750e546a895d9e2f279">KF::~KF</a></div><div class="ttdeci">~KF()</div><div class="ttdoc">Destructor, nothing happens here.</div><div class="ttdef"><b>Definition:</b> kf.cpp:15</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_dc133b73f91f0e3b4287924ed00a2a00.html">kalman</a></li><li class="navelem"><a class="el" href="kf_8h.html">kf.h</a></li>
    <li class="footer">Generated on Thu Apr 1 2021 04:15:37 for kalman-cpp by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </li>
  </ul>
</div>
</body>
</html>
